package com.amorcloud.pig.utils;

import com.amorcloud.pig.MyApp;
import com.amorcloud.pig.bean.UserInfoBean;

import java.util.List;

public class UserDaoUtils {

    public static List<UserInfoBean> queryAll() {
        return MyApp.getDaoInstant().getUserInfoBeanDao().loadAll();
    }

    public static UserInfoBean queryById(long id) {
        return MyApp.getDaoInstant().getUserInfoBeanDao().load(id);
    }

    public static List<UserInfoBean> queryWhere(String where, String ... param) {
        return MyApp.getDaoInstant().getUserInfoBeanDao().queryRaw(where, param);
    }

    public static long insertUser(UserInfoBean userInfoBean) {
        return MyApp.getDaoInstant().getUserInfoBeanDao().insert(userInfoBean);
    }

    public static void deleteById(long id) {
        MyApp.getDaoInstant().getUserInfoBeanDao().deleteByKey(id);
    }

    public static void updateUser(UserInfoBean userInfoBean) {
        MyApp.getDaoInstant().getUserInfoBeanDao().update(userInfoBean);
    }

}
